package com.albert;

import com.alibaba.fastjson.JSONObject;

import java.math.BigDecimal;
import java.util.Map;

public class Decimal {
    public static void main(String[] args) {

        String s = "{\"UnitsAbbreviation\":\"\",\"Annotated\":false,\"Substituted\":false,\"Value\":" +
                "{\"Value\":0,\"IsSystem\":false,\"Name\":\"OFF\"}," +
                "\"Good\":true,\"Timestamp\":\"2024-10-12T07:34:32.027008Z\",\"Questionable\":false}";
        JSONObject jsonObject = JSONObject.parseObject(s);
        String valu = jsonObject.getJSONObject("Value").getString("Value");
        System.out.println(valu);

        String str = "{\"UnitsAbbreviation\":\"\",\"Annotated\":false,\"Substituted\":false,\"Value\":0.0,\"Good\":true,\"Timestamp\":\"2024-10-12T07:27:01.3960113Z\"}";
        Map<String, Object> map = JSONObject.parseObject(str);
        BigDecimal value = (BigDecimal) map.get("Value");
        System.out.println(value);
    }
}
